package com.zx.callback.common.ex;


import com.zx.callback.common.enums.MessageEnumTable;

/**
 * JSON 相应处理异常
 * Created by yanst on 2016/6/29.
 */
public class JsonResponseException extends RuntimeException {

    private MessageEnumTable messageEnumTable;

    private String message;

    public JsonResponseException(MessageEnumTable messageEnumTable) {
        super(messageEnumTable.getMessage());
        this.messageEnumTable = messageEnumTable;
    }

    public JsonResponseException(String message, MessageEnumTable messageEnumTable) {
        super(message);
        this.message = message;
        this.messageEnumTable = messageEnumTable;
    }

    /**
     * 非法请求异常验证方法
     * @param message
     * @return
     */
    public static JsonResponseException jsonValidationException(String message){
        return new JsonResponseException(message, MessageEnumTable.SYS__999);
    }

    public MessageEnumTable getMessageEnumTable() {
        return messageEnumTable;
    }

    public void setMessageEnumTable(MessageEnumTable messageEnumTable) {
        this.messageEnumTable = messageEnumTable;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
